00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00051 if (!empty($_SERVER['REQUEST_URI']) && (strstr($_SERVER['REQUEST_URI'], "class.header.inc.php"))) {
00052 die();
00053 }
00054 include_once ('./classes/class.functions.inc.php');
00055 require_once ("./classes/class.photofunctions.inc.php");
00056 require_once (PATH_TO_ROOT.'common/classes/class.bbcode.inc.php');
00057 require_once (PATH_TO_ROOT."roleplay/classes/class.roleartefacts.inc.php");
00058
00059
00060 if (!empty($_REQUEST)) extract($_REQUEST, EXTR_SKIP);
00061 if (get_magic_quotes_gpc()) {
00062 $_GET = r_stripslashes($_GET);
00063 $_POST = r_stripslashes($_POST);
00064 $_COOKIE = r_stripslashes($_COOKIE);
00065 $GLOBALS = r_stripslashes($GLOBALS);
00066 }
00067
00068
00069 if (isset($threadid)) $thread['threadid'] = $threadid;
00070 if (isset($boardid)) $board['boardid'] = $boardid;
00071 if (isset($postid)) $post['postid'] = $postid;
00072 if (isset($categoryid)) $category['categoryid'] = $categoryid;
00073 if (isset($categoryname)) $category['categoryname'] = $categoryname;
00074
00075
00076 $debug = '';
00077
00078 $navpath = '';
00079 $navigation = array();
00080 $config = array();
00081 $option = array();
00082 if (!isset($time)) $time = '';
00083
00084
00085 define('P_VIEW', 0);
00086 define('P_REPLY', 1);
00087 define('P_POSTNEW', 2);
00088 define('P_CLOSE', 3);
00089 define('P_DELTHREAD', 4);
00090 define('P_OMOVE', 5);
00091 define('P_DELPOST', 6);
00092 define('P_EDIT', 7);
00093 define('P_OCLOSE', 8);
00094 define('P_ODELTHREAD', 9);
00095 define('P_ODELPOST', 10);
00096 define('P_OEDIT', 11);
00097 define('P_TOP', 12);
00098 define('P_EDITCLOSED', 13);
00099 define('P_IP', 14);
00100 define('P_EDITTOPIC', 15);
00101 define('P_NOFLOODPROT', 16);
00102 define('P_NOEDITLIMIT', 17);
00103 define('P_CANSEEINVIS', 18);
00104 define('P_NOPMLIMIT', 19);
00105 define('P_INTEAM', 20);
00106 define('P_CEVENT', 21);
00107
00108 define("BWORD_NONE", 0);
00109 define("BWORD_TOPIC", 1);
00110 define("BWORD_POST", 2);
00111 define("BWORD_ALL", 3);
00112
00113 $r_registry = forum_query("SELECT keyname, keyvalue, keytype FROM photogallery_registry");
00114 while ($registry = mysql_fetch_array($r_registry)) {
00115 switch ($registry['keytype']) {
00116 case 'integer':
00117 case 'boolean':
00118 $config[$registry['keyname']] = intval($registry['keyvalue']);
00119 break;
00120
00121 case 'array':
00122 if ($registry['keyvalue']) {
00123 $array = explode("\n", $registry['keyvalue']);
00124 while (list($k, $v) = @each($array)) $array[$k] = '"'.addslashes(trim($v)) .'"';
00125 eval("\$config[\$registry['keyname']] = array(".implode(',', $array) .");");
00126 }
00127 break;
00128
00129 default:
00130 $config[$registry['keyname']] = $registry['keyvalue'];
00131 }
00132 }
00133 $mainBBCode = new BBCode(true, $config["imageslevel"] != 2, (bool)$config["smilies"]);
00134 $tagOverviewLink = BBCode::getTagOverviewLink("Formatierungs-<br />möglichkeiten");
00135
00136 $r_user = forum_query("SELECT username, userID, userhidesig, usersignature,
00137 userbanned, userisadmin, userlastpost, usernoding, groupids, autoabo FROM forum_user
00138 WHERE userID='".intval($_SESSION['userid']) ."'");
00139 $g_user = mysql_fetch_array($r_user);
00140 if (mysql_num_rows($r_user) < 1) {
00141 unset($g_user);
00142 $g_user['userID'] = 0;
00143 $g_user['groupids'] = $config['guest_groupid'];
00144 $g_user['username'] = "Deaktiviert";
00145 $g_user['userisadmin'] = 0;
00146 $g_user['userbanned'] = 0;
00147 $g_user['userhidesig'] = false;
00148 } else {
00149 $g_user['groupids'] = substr($g_user['groupids'], 1, strlen($g_user['groupids']) -2);
00150 }
00151 $g_user['userhtmlname'] = Data::toHTML($g_user['username'], false);
00152 if ($config['forumclosed'] && !$g_user['userisadmin']) {
00153 $navpath = 'FotoForum geschlossen!';
00154 errormessage('FotoForum geschlossen', $mainBBCode->parse(implode("\n", $config['closedmsg'])));
00155 }
00156
00157 if (isset($board['boardid']) && $board['boardid'] < 0) {
00158 header('Location: '.build_link('index.php?categoryid='.(intval($board['boardid']) *-1), true));
00159 exit;
00160 }
00161
00162 if ($g_user['userisadmin'] && $config['debugmode']) {
00163 $DEBUG = '<strong>Debug Messages:</strong><br/>'.$DEBUG;
00164 } else $DEBUG = "";
00165
00166 $lastvisited = '';
00167 if ((preg_match("@board.php@", $_SERVER['PHP_SELF']) && isset($boardid)) || preg_match("@showtopic.php@", $_SERVER['PHP_SELF'])) {
00168 if (!isset($boardid) && isset($threadid)) $board['boardid'] = $db->get_var("SELECT boardid FROM forum_thread WHERE threadid=".intval($threadid));
00169 if ($g_user['userID'] != 0) {
00170 $r_lastvisited = forum_query("SELECT lastvisitedtime FROM forum_lastvisited WHERE userID=$g_user[userID] AND boardid='".intval($board['boardid']) ."'");
00171 $lastvisited = mysql_fetch_array($r_lastvisited);
00172 if (!$lastvisited['lastvisitedtime']) {
00173
00174 forum_query("INSERT INTO forum_lastvisited (userID, boardid, lastvisitedtime) VALUES($g_user[userID], '".intval($board['boardid']) ."', ".time() .")");
00175 $lastvisited = 0;
00176 } else {
00177 if (mysql_num_rows(forum_query("SELECT boardid FROM forum_board WHERE boardid = '".intval($board['boardid']) ."' AND is_photogallery=1"))) {
00178 $lastvisited = $lastvisited['lastvisitedtime'];
00179 forum_query("UPDATE forum_lastvisited SET lastvisitedtime=".time() ." WHERE userID=$g_user[userID] AND boardid='".intval($board['boardid']) ."'");
00180 }
00181 }
00182 }
00183 }
00184 if (isset($post['postid'])) {
00185 $post['postid'] = intval($post['postid']);
00186 $r_post = forum_query("SELECT postid, threadid FROM forum_post WHERE postid='$post[postid]'");
00187 if (mysql_num_rows($r_post) < 1) {
00188 errormessage("Fehler", "Post existiert nicht");
00189 }
00190 $post = mysql_fetch_array($r_post);
00191 $thread['threadid'] = $post['threadid'];
00192 }
00193 if (isset($thread['threadid'])) {
00194 $thread['threadid'] = intval($thread['threadid']);
00195 $r_thread = forum_query("SELECT threadid, boardid, threadtopic, threadreplies, threadlink, threadclosed, acklevel, ackpost, userID
00196 FROM forum_thread WHERE threadid='$thread[threadid]'");
00197 if (mysql_num_rows($r_thread) < 1) {
00198 errormessage("Fehler", "Thread existiert nicht");
00199 }
00200 $thread = mysql_fetch_array($r_thread);
00201 $navigation[] = "<a href=\"".build_link("showtopic.php?threadid=$thread[threadid]&time=$time") ."\" title=\"Gehe zu ".Data::toHTML($thread['threadtopic'], false) ."\">".Data::toHTML($thread['threadtopic'], false) ."</a>";
00202 $board['boardid'] = $thread['boardid'];
00203 }
00204 if (isset($board['boardid'])) {
00205 $board['boardid'] = intval($board['boardid']);
00206 $r_board = forum_query("SELECT boardid, boardname, boardthreads, boarddisabled, helpdesk FROM forum_board WHERE boardid=$board[boardid] AND is_photogallery=1");
00207 if (mysql_num_rows($r_board) < 1) {
00208 errormessage("Fehler", "Board existiert nicht");
00209 }
00210 $board = mysql_fetch_array($r_board);
00211 $navigation[] = "<a href=\"".build_link("board.php?boardid=$board[boardid]&time=$time") ."\" title=\"Gehe zu ".Data::toHTML($board['boardname'], false) ."\">".Data::toHTML($board['boardname'], false) ."</a>";
00212 }
00213
00214 global $P;
00215 if (isset($board['boardid'])) {
00216 $P = new Permission($g_user['groupids'], $board['boardid'], isset($_SESSION["invisible"]));
00217
00218 } else {
00219 $P = new Permission($g_user['groupids']);
00220 }
00221
00222 $course_name = Data::toHTML($db->get_var("SELECT categoryname FROM forum_category WHERE categoryid='".$_SESSION['course']."'"), false);
00223 $navigation[] = "<a href=\"".build_link("index.php") ."\" title=\"Gehe zu $course_name\">$course_name</a>";
00224 $navigation = forum_array_reverse($navigation);
00225 while (list($key, $val) = each($navigation)) {
00226 $navpath.= "$val » ";
00227 }
00228
00229 $topicicon = array(1 => 'fullalpha', 2 => 'smile', 3 => 'wink', 4 => 'angry', 5 => 'frown', 6 => 'biggrin', 7 => 'gumble', 8 => 'question', 9 => 'strange', 10 => 'rolleyes', 11 => 'oah', 12 => 'prefect');
00230
00231 if ($g_user['userbanned'] == 1) {
00232
00233 $r_ban = forum_query("SELECT banpubreason, banexpire FROM forum_ban WHERE userID=$g_user[userID] AND courseID=-1");
00234 $ban = mysql_fetch_array($r_ban);
00235 if (mysql_num_rows($r_ban) > 0) {
00236 if ($ban['banexpire'] > time() || $ban['banexpire'] == 0) {
00237 $message = "Sie sind aus allen Foren des Portals ausgeschlossen<br/><br/>Grund: <em>".($ban['banpubreason'] ? $ban['banpubreason'] : "(Keine Angabe)") ."</em><br/><br/>Diese Verbannung".($ban['banexpire'] ? (" ist gültig bis: ".form_date($ban['banexpire']) .".") : " ist permanent.") ."<br/><br/>";
00238 errormessage('Forum', $message);
00239 } else {
00240 forum_query("DELETE FROM forum_ban WHERE userID=$g_user[userID] AND courseID=-1");
00241 }
00242 }
00243
00244 $r_ban = forum_query("SELECT banpubreason, banexpire FROM forum_ban WHERE userID=$g_user[userID] AND courseID=".$_SESSION['course']);
00245 $ban = mysql_fetch_array($r_ban);
00246 if (mysql_num_rows($r_ban) > 0) {
00247 if ($ban['banexpire'] > time() || $ban['banexpire'] == 0) {
00248 $message = "Sie sind aus dem FotoForum dieses Kurses ausgeschlossen<br/><br/>Grund: <em>".($ban['banpubreason'] ? $ban['banpubreason'] : "(Keine Angabe)") ."</em><br/><br/>Diese Verbannung".($ban['banexpire'] ? (" ist gültig bis: ".form_date($ban['banexpire']) .".") : " ist permanent.") ."<br/><br/>";
00249 errormessage('Forum', $message);
00250 } else {
00251 forum_query("DELETE FROM forum_ban WHERE userID=$g_user[userID] AND courseID=".$_SESSION['course']);
00252 }
00253 }
00254
00255 $r_ban = forum_query("SELECT banpubreason, banexpire FROM forum_ban WHERE userID=$g_user[userID]");
00256 $ban = mysql_fetch_array($r_ban);
00257 if (mysql_num_rows($r_ban) < 1) {
00258 forum_query("UPDATE forum_user SET userbanned=0 WHERE userID=$g_user[userID]");
00259 }
00260 }
00261 $CONTENT = '';
00262 $titleprepend = '';